-
Notifications
You must be signed in to change notification settings - Fork 8
add permission to rubrics, awards and divisions #1526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
johnmeshulam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few small things:
1 - don't use MutationError, you can create a new ResolverError class
2- If the main divisions resolver checks division assignment, lets remove it from the other resolver checks
3- for the awards and rubrics checks, lets not check the root (since reports for example can query awards), instead:
-
Create an awardWinnerResolver which will resolve the winner field, and restrict only that resolver. The restriction should be either judge-advisor, or any user if the awards have been locked (use placeholder logic for locking for now)
-
Use the existing rubricDataResolver to restrict access only to the rubric data to the allowed roles
johnmeshulam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** | ||
| * Resolver for Judging.rubrics field. | ||
| * Fetches rubrics for teams in a division, optionally filtered by team IDs or category. | ||
| * Only accessible to lead-judge and judge-advisor roles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover comment?
| > = async (division: DivisionWithId, args: AwardsArgs, context: GraphQLContext) => { | ||
| try { | ||
| // Check authorization | ||
| if (!allowedRoles.has(context.user.role)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This checks auth on awards resolver without winners
| * @param _args - Unused arguments | ||
| * @param context - GraphQL context containing user information | ||
| */ | ||
| export const divisionAwardsWinnersResolver: GraphQLFieldResolver< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice resolver :)

Description
Please include a summary of the changes made, and the related issue.
List any dependencies that are required for this change.
Closes # (issue)
Type of change
Please delete options that are not relevant.
Screenshots
Please provide screenshots of changes made to UI components.
Checklist